package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000116670660";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC1QJ/Aniq88FHvII0KzrYpq+w3jOmy5VTFWr1PrI15EsK1yJWdvrL2cb6Henu4ciBU1iThh/KxxSZI8/w4EnTD6lpHuOVu9fdKh3cLPoLax9fSX1bE/mYtQAfT9bkDobuMde3ishoDhc62ZwOlpGsObrZS7JKLkKIqHiqwfOQc13UwdMsdrf6Y5RjGXDCxkXHEK3WyhdB1BCLnnAlicWlQJzZAc9kh45+89EWVu3F10jboW4RCXtnL2pWSpp2Y0VWJ/BhhPjeaNYKMB0v9+7kO78ezi2YuP9a9cIwB8TmzDvuau3hsFQD3BMhM7oZEOSm4WcmsBRkAHvc5z6Om83zvAgMBAAECggEBALDkGQULV/p9L/mIcx4RD4cr2qV8SLfnSQwyun9/j7KRtKVk1V/WNSJ/b8sYppYkC5nARM42t4z3M54PQCAZIwvxM5q7wG7Cbk22V2AJ6ftK/j65/RzUizOuQfWC4sXAmiFDFp8f4nN9q3gooU6PYEv9kMLtTzgWN62TM2Z6/MWHdyw+BAUIGSxX64mxFxNISxhteXhO7hScY5uKrc9i0r4GsFNJztjk6p6MA6SBC39Yy4hQtL5kQj1Aw78QGQYEBZz06D98neSrJdX5fRflOCFsyyBE+c8bWvoSSE4nOYYMLm74KY/Jv2Xx4S4U06XNms+vvvkhsQ3tuG/nxthcmYECgYEA/Z9lHKlrukKyjS8YW+aWG1drY6hIgRitcxLH0N+aO8/OF5kcn229AFxAAHHOODSeZysmAAlgU0w5pKXRxpmYWrxSnMRIxeze2NnPb4MYrOop5OQj8T+yXBNhsmVF/+FCHXFWfttWJelT9lWCuNjRMizd1Vmtc8RH7XA49trCKBkCgYEAtvOQ6cZn3ZlGZe3L6cfQeCOVD1vz9Wb9zGS72R1+okZi3ESts/H/m658e4IcW2shpQUb6Ymd2ry1+Wk+6/pFc/aS0uoC71m66FKkJAHXjVmN5ZNdvxLoHpXErqOu4J9o8ou7x2wZ9LPmxwQLguYBd+yG0IUPNRnnV8w2nrVRDkcCgYAiPrB3Y0ThfHoBaDeAySzBeldMuH85tyxMWl/Siy6XHuLz+r+Lo1SexNX7eWJf4nL0+TWDUcDI3oT1/1HI4BpbPgxlkHdHCkm4vAgvRWNCjcekWU2lGHWryw4o+VWvTCoSMah9Ln5+Vff5Teh9rwDoJni5gwdRl1Ii9EEsy7LlmQKBgB2rOiDvMADbznLRMXRkFwaknpOzEckGPrpay6vWAKdIStf1u0WnRRB2J3HQE9EvenFMds5UpujGGaysyKt0FrdLkVvq3zb5kjoCzOOZ+N7PWxeT4mwOIN5040R+/ukmcNqElpssiLkKQ66alVNRAYP1M5e1PFYcMUwnrePm+5IZAoGAcH+p9DMna68oVUI9bkCpfNz4PuHqUvfRDwABpsEKLj/SNi1apSVLeTI2IEaAw8Uvq0s1T0GZ8kd7aO+EHZEhHd7IRS/EHkW/XOQxghyvNhEHbct0lB2z2yBKY3aC6t0UkxHt2x+9/RbHanUfJAK6gO6nrT3wHBq3S4Ll0IgJ8x8=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlFaKvjVatdsgv1nAqkc0VPZWtUrUkls5fZqcse9g1rdGRBEkvm1qGAbuAP41x9WvM9+DFsHVY+mUFo0Z4yjK9zZvOo5Q87JKiHFrW6EUI5zQU4ekyBcZ7A9XqTNaYX61+EXNZ+Ba19pMQvaenr9jqWSwh1/MrrN7YFO97gdWr81RRkIBJSaYwbxwn9GX9NjeeqscjcrqvRZ2ok5wwsDjX0PEnJ19mo9hGpgpTuFeAn38EhAB6OQe8XEOzSi9KycQbK8CPqG54AXKd85qje/p4nik5PyVCfU3bseHnsijXnlEUopZ6kaYufy4w6ZXOedHOmTpX2dKG/XIarsJeBFnTwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/06_war_exploded/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/06_war_exploded/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:/logs/alipayDamo";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

